Skip to content

Sync addons-source@maintenance/gramps61 with upstream (2026-06-08)#44

Open
eduralph wants to merge 21 commits into
maintenance/gramps61from
sync/upstream-maintenance-gramps61-auto
Open

Sync addons-source@maintenance/gramps61 with upstream (2026-06-08)#44
eduralph wants to merge 21 commits into
maintenance/gramps61from
sync/upstream-maintenance-gramps61-auto

Conversation

@eduralph

@eduralph eduralph commented Jun 8, 2026

Copy link
Copy Markdown
Owner

Automated nightly sync from gramps-project/addons-source@maintenance/gramps61. Generated by .github/workflows/upstream-sync.yml on the testbed.

DaveSch-gramps and others added 6 commits June 7, 2026 09:30
Adds the new FS Integrations preferences Tab to the Themes' overriding panel list.
Re-searching the same place name now returns instantly from an in-session
cache instead of re-querying the geocoding service, which is faster and
kinder to the Nominatim usage policy. Applies to both the geopy/Nominatim
and GeocodeGlib code paths.
@eduralph eduralph force-pushed the sync/upstream-maintenance-gramps61-auto branch 2 times, most recently from 123b713 to a9a3f71 Compare June 10, 2026 07:58
dsblank and others added 8 commits June 10, 2026 13:56
The previous code used DROP+CREATE on every connection startup.
Replace with a pg_collation existence check so the collation is
only created when absent. This also preserves column_exists and
drop_column methods added for schema migration support.

Also apply black formatting throughout the file.

Fixes #65803.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Remove the monolithic _hack_query() string-substitution function and
replace it with dialect-aware overrides on the PostgreSQL class:
- _sql_type() returns 'bytea' instead of 'BLOB'
- _quote_column() properly quotes PostgreSQL reserved words (e.g. 'desc')
  rather than blindly renaming them; marked for removal once gramps PR
  #2178 (which adds _quote_column to the DBAPI base) is merged
- Connection.execute() handles only the two remaining SQL syntax
  differences: qmark→format paramstyle and REGEXP→~ operator
- Drop dead LIMIT rewriting code (not generated by current dbapi.py)
- Remove now-unused 'import re'

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…tabases

Quoting the reserved word as "desc" would require a migration for every
existing PostgreSQL database where the column was already created as
desc_ by the old _hack_query. Using desc_ keeps backward compatibility.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Add back LIMIT offset,count → LIMIT count OFFSET offset and
LIMIT -1 → LIMIT ALL rewrites in Connection.execute(), using
re.sub with a staticmethod replacer to match the style of the
other dialect translations.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
23 tests covering all four rewrite rules in Connection.execute()
(qmark→%s, REGEXP→~, LIMIT offset,count, LIMIT -1→ALL), plus
_sql_type BLOB→bytea and _quote_column reserved-word handling.
psycopg2 is stubbed so no real database is required.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Override _create_secondary_columns, _update_secondary_values, and
get_media_handles in the PostgreSQL class to call self._quote_column()
so reserved words (e.g. desc → desc_) are handled at the right sites
rather than via post-hoc string replacement.

Add a targeted Connection.execute() fix for the one CREATE INDEX site
that has no override hook (CREATE INDEX media_desc ON media(desc)).

All four overrides are marked for removal once gramps PR #2178
(_quote_column hook in DBAPI base) is merged into core.

Also inline the LIMIT rewrite lambda (removing _limit_repl staticmethod)
and drop the redundant TestLimitReplStaticmethod test class.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
…tests

PostgreSQL has no BLOB type; the core _create_schema() hardcodes "BLOB"
in CREATE TABLE statements that bypass _sql_type(). Add a word-boundary
re.sub in execute() to translate BLOB→BYTEA for all SQL passing through
the adapter.

Also add TestExecuteMediaDescIndex and TestExecuteBlobType so every
rewrite rule in execute() is covered by its own test class.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@eduralph eduralph force-pushed the sync/upstream-maintenance-gramps61-auto branch 5 times, most recently from c0f18d6 to 7a8317c Compare June 15, 2026 09:50
eduralph and others added 5 commits June 15, 2026 09:43
GraphView's module body raised a bare Exception while being imported when
the GooCanvas library or the GraphViz `dot` binary was missing. Because the
raise fired at top level, any code importing the module crashed before
Gramps had a chance to decide whether the plugin should load — including the
addon's own test suite, whose collection imports the module at the top level
and aborted with a traceback (0 tests run) on hosts that have no `dot`.

Gramps already declines to load the view when those dependencies are absent:
the requires_gi / requires_exe declarations in graphview.gpr.py drive the
plugin manager's requirement check, which removes the plugin before its
module is ever imported. The import-time raises duplicated that gate while
breaking every direct importer, so this removes them. The missing-dependency
experience for end users is unchanged, because the registration-level gate
remains the sole arbiter of whether the plugin loads.

A new regression test imports the production GraphView.graphview module in a
child interpreter with `dot` made unavailable, and fails if the import
raises, so GraphView/tests/ now collects and runs on a host lacking `dot`.
The Deep Connections Gramplet searches outward from the Home person and
reports how the active person connects back to them. When the active
person reached Home through one of Home's own direct relatives -- for
example a niece or nephew, who is the child of Home's sibling -- the
reported path named the Home person as an intermediate relationship step
("... / sibling of <Home> / ...") on top of its terminal root. The Home
person is the search origin, so it should appear in a path only as that
root, never as an interior anchor.

The search now keeps the Home person out of the body of every produced
path: a relative that is the Home person is dropped, and when the Home
person is the node being expanded its relatives attach directly to the
root rather than through a redundant "of <Home>" step. Paths still
terminate at the Home person and still connect the active person to
them; only the spurious interior mention is removed. The renderer and
the rest of the search loop are unchanged.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>

Fixes #8653
The tests/ suite (run by `python3 -m unittest discover -s tests`) imports
gramps.gui.* modules directly, which bypasses the Gramps GUI launcher's own
gi.require_version. On a host where GTK 4 is the default GI resolution, Gtk/Gdk
then load unpinned — emitting PyGIWarning and risking the wrong stack (and the
GUI-touching tests silently skipping).

Pin both in tests/__init__.py, which `unittest discover -s tests` imports before
any test module, so the whole repo-root suite runs on the GTK 3 / GDK 3 stack a
real Gramps session uses. tests/test_gtk_version_pin.py guards it (skips where
the 3.0 typelibs are absent).

Verified: `python3 -m unittest discover -s tests -p "test_*.py" -t .` pins both
(get_required_version == "3.0"); the guard is red without the pin.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@eduralph eduralph force-pushed the sync/upstream-maintenance-gramps61-auto branch from 7a8317c to 608f565 Compare June 16, 2026 09:15
On maintenance/gramps61, TMGimporter/tests/test_libtmg.py carried the 13
real-database import test classes alongside the pure-function tests. Those
DB-backed tests drive an in-memory Gramps database, and on the Windows CI
lane the only available Gramps comes from conda-forge (no 6.1 yet, resolving
to 6.0.8); run against that mismatched core the import path hangs, so the
file had grown two stopgaps to cope: an inline gi.require_version GTK/Gdk pin
block at the top and a sys.platform == "win32" SkipTest inside _make_db().

This separates an addon's OS-environment-dependent tests from its portable
ones by file placement, following the test_<os>_* convention: a test a lane
cannot run is no longer placed in a file that lane executes. The 13
DB-backed classes and their shared helpers (_Rec, _table, _make_db,
_add_person) move verbatim into a new Linux-only TMGimporter/tests/
test_linux_libtmg.py; test_libtmg.py keeps only the pure-function tests and
its reduced "from gramps.gen.lib import Date" import. As a result the two
runtime stopgaps disappear — the Linux lane runs both modules against the
matching Gramps 6.1, while the Windows lane excludes test_linux_* and no
longer hangs.

This brings maintenance/gramps61 in line with the equivalent split already
merged on maintenance/gramps60 by upstream PR 949, which addressed the
Windows unit-test hang against a mismatched conda-forge Gramps. The
cherry-pick of that split forward had failed because gramps61's
test_libtmg.py had independently diverged in the regions the split rewrites.
gramps60 is untouched. No production code or test logic changes.
@eduralph eduralph force-pushed the sync/upstream-maintenance-gramps61-auto branch 2 times, most recently from 61167c3 to 56a3116 Compare June 18, 2026 08:29
@eduralph eduralph force-pushed the sync/upstream-maintenance-gramps61-auto branch from 56a3116 to 765e8fe Compare June 19, 2026 08:57
@eduralph eduralph force-pushed the sync/upstream-maintenance-gramps61-auto branch from 765e8fe to cafab3c Compare June 20, 2026 07:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants